
import Vue from 'vue'
const _this = new Vue()
/*
    使用v-click时，
    参数必须为数组，[fn,arguments]
*/
export const click = {
    bind(el, binddings) {
        const ev = binddings.value
        el.onclick = (e) => {
            e.stopPropagation()
            const user = uni.getStorageSync("user")
            const needAuth = binddings.rawName.split(':')[1] == 'auth'
            const params = ev[1]
            if((params?.auth || needAuth) && !user){
                // 弹窗模式
                // return _this.$bus.$emit('showLogin')
                // 页面路由
                return uni.navigateTo({
                    url:'/pages/login/index'
                })
            }
            ev[0](params)
        }
    },

}